import jakarta.servlet.*;
import jakarta.servlet.http.*;
import jakarta.servlet.annotation.*;

import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "Cookie", value = "/Cookie")
public class cookie extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        String uName=request.getParameter("username");
        String uPass=request.getParameter("userpassword");
        String uSex=request.getParameter("usersex");
        Cookie coo;
        coo = new Cookie("username",uName);
        response.addCookie(coo);
        coo = new Cookie("userPassword",uPass);
        response.addCookie(coo);
        coo = new Cookie("usersex", uSex);
        response.addCookie(coo);
        PrintWriter out = response.getWriter();
        out.print("success");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
